package cn.xscrum.vtsp.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.xscrum.vtsp.mapper.VtspVolunteerActivityMapper;
import cn.xscrum.vtsp.domain.VtspVolunteerActivity;
import cn.xscrum.vtsp.service.IVtspVolunteerActivityService;
import cn.xscrum.common.core.text.Convert;

/**
 * 志愿者关注活动Service业务层处理
 * 
 * @author xscrum
 * @date 2021-10-12
 */
@Service
public class VtspVolunteerActivityServiceImpl implements IVtspVolunteerActivityService 
{
    @Autowired
    private VtspVolunteerActivityMapper vtspVolunteerActivityMapper;

    /**
	 * 查询志愿者关注活动
     * 
     * @param volunteerId 志愿者关注活动ID
     * @return 志愿者关注活动
     */
    @Override
    public VtspVolunteerActivity selectVtspVolunteerActivityById(Long volunteerId)
    {
        return vtspVolunteerActivityMapper.selectVtspVolunteerActivityById(volunteerId);
    }

    /**
	 * 查询志愿者关注活动列表
     * 
     * @param vtspVolunteerActivity 志愿者关注活动
     * @return 志愿者关注活动
     */
    @Override
    public List<VtspVolunteerActivity> selectVtspVolunteerActivityList(VtspVolunteerActivity vtspVolunteerActivity)
    {
        return vtspVolunteerActivityMapper.selectVtspVolunteerActivityList(vtspVolunteerActivity);
    }

    public VtspVolunteerActivity selectVolunteerCollect(Long volunteerId, Long activityId)
    {
        return vtspVolunteerActivityMapper.selectVolunteerCollect(volunteerId,activityId);
    }

    /**
	 * 新增志愿者关注活动
     * 
     * @param vtspVolunteerActivity 志愿者关注活动
     * @return 结果
     */
    @Override
    public int insertVtspVolunteerActivity(VtspVolunteerActivity vtspVolunteerActivity)
    {
        return vtspVolunteerActivityMapper.insertVtspVolunteerActivity(vtspVolunteerActivity);
    }

    /**
	 * 修改志愿者关注活动
     * 
     * @param vtspVolunteerActivity 志愿者关注活动
     * @return 结果
     */
    @Override
    public int updateVtspVolunteerActivity(VtspVolunteerActivity vtspVolunteerActivity)
    {
        return vtspVolunteerActivityMapper.updateVtspVolunteerActivity(vtspVolunteerActivity);
    }

    /**
	 * 删除志愿者关注活动对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteVtspVolunteerActivityByIds(String ids)
    {
        return vtspVolunteerActivityMapper.deleteVtspVolunteerActivityByIds(Convert.toStrArray(ids));
    }

    /**
	 * 删除志愿者关注活动信息
     * 
     * @param volunteerId 志愿者关注活动ID
     * @return 结果
     */
    @Override
    public int deleteVtspVolunteerActivityById(Long volunteerId)
    {
        return vtspVolunteerActivityMapper.deleteVtspVolunteerActivityById(volunteerId);
    }
    /**
     * 取消关注
     *
     * @param volunteerId	志愿者id
     * @param activityId	活动id
     * @return
     */
    @Override
    public int deleteCollectById(Long volunteerId, Long activityId) {
        return vtspVolunteerActivityMapper.deleteCollectById(volunteerId, activityId);
    }
    @Override
    public int deleteVtspVolunteerActivityById2(Long volunteerId, Long activityId) {
        return vtspVolunteerActivityMapper.deleteVtspVolunteerActivityById2(volunteerId, activityId);
    }
}
